package com.focus.pay.wx.action.v2;

import com.focus.pay.wx.config.WxPayConfig;
import com.focus.pay.core.annation.PayOrderHandler;
import com.focus.pay.core.enums.ChannelTypeEnum;
import com.focus.pay.core.enums.Version;
import com.focus.pay.core.exception.PayException;
import com.focus.pay.wx.model.order.v2.WxPayModelUnifiedResponse;
import com.focus.pay.wx.utils.WxPayUtils;

/**
 * @Author: 赵参谋
 * @Date: 2021/10/11 17:47
 * @Description: 微信APP支付V2
 * <link>https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=8_1</link>
 */
@PayOrderHandler(channelType = ChannelTypeEnum.WxType.App,version = Version.VERSION_2)
public class WxPayOrderApp extends WxPayOrderJSAPI {

    /**
     * 返回数据处理
     */
    @Override
    public WxPayModelUnifiedResponse handle(String res, WxPayConfig wxPayConfig) throws PayException {
        WxPayModelUnifiedResponse wxPayModelUnifiedResponse = super.resolvingResult(res, WxPayModelUnifiedResponse.class);
        wxPayModelUnifiedResponse.setPageData(WxPayUtils.AppRecall(wxPayModelUnifiedResponse,wxPayConfig, Version.VERSION_2));
        return wxPayModelUnifiedResponse;
    }
}
